import request from '@/utils/request'

export function getAccount(query) {
  return request({
    url: '/api/account/',
    method: 'get',
    params: query
  })
}
export function searchAccount(query) {
  return request({
    url: '/api/account/search_user',
    method: 'get',
    params: query
  })
}
export function createAccount(data) {
  return request({
    url: '/api/account/update_user/',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data: data
  })
}

export function updateAccount(id, data) {
  return request({
    url: '/api/account/' + id + '/',
    method: 'patch',
    headers: {
      'Content-Type': 'application/json'
    },
    data: data
  })
}

// 修改自己的密码
export function updateSelfPassword(data) {
  return request({
    url: '/api/account/reset_self_password/',
    method: 'patch',
    headers: {
      'Content-Type': 'application/json'
    },
    data: data
  })
}

// 修改用户的密码
export function updateUserPassword(user_id, data) {
  return request({
    url: '/api/account/' + user_id + '/reset_user_password/',
    method: 'patch',
    headers: {
      'Content-Type': 'application/json'
    },
    data: data
  })
}

export function deleteAccount(id) {
  return request({
    url: '/api/account/' + id + '/',
    method: 'delete'
  })
}

// 同步统一认证处的教师信息
export function updateTeacher() {
  return request({
    url: '/api/account/update_teacher/',
    method: 'post'
  })
}

// 获取学院
export function getFaculty(data) {
  return request({
    url: '/api/faculty/',
    method: 'get',
    params:data
  })
}